/**
 * 
 */
package se.chalmers.spexet.booking.common;
import java.util.*;
import java.io.*;
/**
 * @author Winquman
 *
 */
public abstract class Settings {
	private Map<String,Setting> settings;
	
	public Settings(String path) {
		settings = new HashMap<String,Setting>();
		FileReader fr;
		BufferedReader br;
		String line, ss[];
		try {
			fr = new FileReader(path);
			br = new BufferedReader(fr);
			
			while(br.ready()) {
				line = br.readLine();
			
				ss = line.split("=");
				if(ss.length == 2) {
					settings.put(ss[0], new Setting(ss[1]));
				}
			}
		} catch (IOException e) {
			System.err.println("ERROR: Unable to open settings file: " + path);
			e.printStackTrace();
			System.exit(-1);
		}
	}
	
	public Setting getSetting(String s) {
		return settings.get(s);
	}
}
